<template>
	<div class="school">
		<h2>我是School组件</h2>
		<h2>学校地址：{{address}}</h2>
		<h2 v-show="name">学生姓名：{{name}}</h2>
		<button @click="death">销毁School的vc</button>
	</div>
</template>

<script>
	export default {
		name:'School',
		data() {
			return {
				name:'',
				address:'宏福科技园'
			}
		},
		mounted() {
			console.log('School组件挂载完毕了',this.x)
			this.$bus.$on('haha',(value)=>{
				console.log('$bus这个傀儡身上的haha事件被触发了',value)
				this.name = value
			})
		},
		beforeDestroy() {
			this.$bus.$off('haha')
		}
	}
</script>

<style>
	.school{
		background-color: orange;
		padding: 20px;
	}
</style>